﻿using System.Collections.Generic;
using System.Linq;
using MovieAPI.Models;
namespace MovieAPI.DAL
{
    public class DirectDAL
    {

        /// <summary>
        /// 通过ID查询导演
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public static Direct GetDirectByID(int ID)
        {
            using (filmEntities db = new filmEntities())
            {
                return db.Direct.Where(D => D.DirectID == ID).FirstOrDefault();
            }

        }
        /// <summary>
        /// 通过名字查询导演 
        /// </summary>
        /// <param name="Name"></param>
        /// <returns></returns>
        public static List<Direct> GetDirectByName(string Name)
        {
            using (filmEntities db = new filmEntities())
            {
                return db.Direct.Where(D => D.DirectName.Contains(Name)).ToList();
            }

        }
    }
}